<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>委托您的房子吧</title>
	{css href="_css_/owner_ask.css"}
	{css href="_js_/layui/css/layui.css"}
	{js href="_js_/jquery2.1.4.min.js"}
	{js href="_js_/layer/layer.js"}
	{js href="_js_/layui/layui.js"}
	{js href="_js_/jquery.validate.min.js"}
	{js href="_js_/additional-methods.js"}
	{js href="_js_/jquery.form.js"}
</head>
<body>
	<form class="layui-form" method="post" action="javascript:;">
		<a class="layui-icon close" href="javascript:;">&#x1007;</a>
		<div class="layui-input-item title">
			<label>委托您的房子吧</label>
		</div>
		<div class="layui-input-item" style="height: 40px">
			<select name="city">
				<option value="">请选择城市</option>
				<option value="1">常州市</option>
			</select>
		</div>
		<div class="layui-input-item" style="height: 40px">
			<select name="area">
					<option value="">请选择区/县</option>
					{volist name="data_area" id="vo"}
					<option value="{$vo.id}">{$vo.name}</option>
					{/volist}
				</select>
		</div>
		<div class="layui-input-item" style="height: 40px">
			<i class="layui-icon">&#xe658;</i><input class="layui-input-inline" type="text" name="vill" placeholder="请填写小区" required rangelength=[3,8]>
		</div>
		<div class="layui-input-item" style="height: 40px">
			<i class="layui-icon">&#xe658;</i><input class="layui-input-inline" type="text" name="addr" placeholder="房屋地址，例：26幢3单元1101" required rangelength=[3,20]>
		</div>
		<div>
			<button class="layui-btn" type="submit" id="submit">提&nbsp;交</button>
		</div>
		<div>
			<b style="font-size:20px;margin-left:90px;color:#ff3366" class="layui-icon">&#xe63b;</b>
			<span style="font-size:18px;margin-left:10px;">400-018-2323</span>
		</div>
	</form>

<script type="text/javascript">
	$().ready(function(){
		$('form').validate({
			rules:{

			},
			messages:{
				vill:{
					required:'请填写小区',
					rangelength:'小区格式错误',
				},
				addr:{
					required:'请填写房屋地址',
					rangelength:'地址格式错误',
				},
			},
			submitHandler:function(form){
				$(form).ajaxSubmit({
					type:'post',
					url:'{:url('index/owner/do_ask')}',
					datatype:'text',
					success:function(res){
						console.log(res);
						if(res.msg == '提交成功'){
							layer.msg(res.msg+',稍后工作人员会与您联系！',{icon:1,time:2000},function(){var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);});
						}else{
							layer.msg(res.msg,{icon:2,time:1000});
						}
					}
				})
			}
		})
	})

	$('.close').click(function(){
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);	
	});

	layui.use('form',function(){
		var form = layui.form;
		form.render();
	});
</script>
</body>
</html>